import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0YKA6NLamyrEVavb8R4cFDoSqvhxeEb+J2Z9b9JeXYDcA/rCsbk62ygBOm7dYo3/8ctJluwf4eyD2ZVjglN0RRDH0HUkWguAXawRP8IrafTFZmEjczeSccz7nSxKLEDUR9BVkAdQQ/xke+FyYDZ1ympqVCCrTZsrJlD9QoV0rnwIDAQAB'

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}

